const fs = require('fs');
const webpack = require('webpack')

module.exports = function(grunt) {

	require('load-grunt-tasks')(grunt);

	require('time-grunt')(grunt);

	let options = require('./client-src')(grunt)

	let devTaskList = options.devTaskList
	let proTaskList = options.proTaskList

	// console.log(options.conf.webpack)

	grunt.initConfig(options.conf);

	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-nodemon');
	grunt.loadNpmTasks('grunt-concurrent')
	grunt.loadNpmTasks('grunt-webpack')

	// grunt.registerTask('default', devTaskList);
	grunt.registerTask('default', 'dev', function() {
		grunt.task.run(devTaskList)
	});
	grunt.registerTask('pro', 'production env', function() {
		grunt.task.run(proTaskList)
	});
}